﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CustomTypes.Interfaces.Structure;


namespace CSharpParser.Structure
{

    [System.Diagnostics.DebuggerDisplay("Type : {Name}")]
    [Serializable]
    public class TypeCSharpStructure : MemberCSharpStructure, ITypeStructure
    {

        public TypeCSharpStructure(IMemberStructure parent, string name)
            : base(parent, name, name)
        {

        }


        public IMemberStructure BaseType { get; set; }

        public bool IsAbstract { get; set; }

        public bool IsArray { get; set; }



        internal bool ContainsMember(string name)
        {

            foreach (IMemberStructure item in this)            
                if (item.Name == name)
                    return true;

            return false;
        }

        public bool IsAnonymousType { get; set; }

        public bool IsClass { get; set; }

        public bool IsConstructed { get; set; }

        public bool IsContravariant { get; set; }

        public bool IsCovariant { get; set; }

        public bool IsDelegate { get; set; }

        public bool IsDynamic { get; set; }

        public bool IsEnum { get; set; }

        public bool IsInterface { get; set; }

        public bool IsInternal { get; set; }

        public bool IsNested { get; set; }

        public bool IsPointer { get; set; }

        public bool IsPredefinedType { get; set; }

        public bool IsPrivate { get; set; }

        public bool IsProtected { get; set; }

        public bool IsProtectedOrInternal { get; set; }

        public bool IsPublic { get; set; }

        public bool IsReferenceType { get; set; }

        public bool IsSealed { get; set; }

        public bool IsStatic { get; set; }

        public bool IsStruct { get; set; }

        public bool IsTypeParameter { get; set; }

        public bool IsUnknown { get; set; }

        public bool IsValueType { get; set; }

        public IMemberStructure UnderlyingType { get; set; }

        public string GetNamespace()
        {

            StringBuilder s = new StringBuilder();

            if (Parent != null)            
                s.Append((Parent as INamespaceStructure).GetNamespace());
            
            return s.ToString();
        }

        public string GetFullname()
        {

            StringBuilder s = new StringBuilder();

            if (Parent != null)
            {
                s.Append((Parent as INamespaceStructure).GetNamespace());
                s.Append(".");
            }

            s.Append(Name);

            return s.ToString();
        }


        internal bool initialized = false;

        public bool IsAnsiClass { get; set; }

        public bool IsSerializable { get; set; }

        public IInterfaceStructure GetInterface(string p, bool p_2)
        {
            throw new NotImplementedException();
        }





        public IInterfaceStructure[] GetInterfaces()
        {
            throw new NotImplementedException();
        }

        public string AssemblyQualifiedName
        {
            get { throw new NotImplementedException(); }
        }

        public IGenericArgumentStructure[] GetGenericArguments()
        {
            throw new NotImplementedException();
        }
    }

}
